package day1221;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        //1.输入age的值
        Scanner sc=new Scanner(System.in);//1.1.创建输入工具对象用sc表示
        System.out.println("请输入年龄：");//1.2.提示用户输入
        int age=sc.nextInt();
        //2.将输入的age值传入到judgeAge()方法中
        String rs=judgeAge(age);//2.1.调用judgeAge()方法(将age传入judgeAge()方法中)，将结果存入到rs
        System.out.println(rs);//2.2.打印rs得到的方法执行结果
    }

    static String judgeAge(int age){
        if( 0< age  && age<18){
            return "未成年";
        }else if(8<= age  && age<26){
            return  "青年";
        }else if(20<= age  && age<55){
            return  "中年";
        }else{
            return "老年";
        }
    }

    static void f(int age){
        switch(age){
            case 1:  System.out.println();  break;  //类似于 if
            case 2:  System.out.println();   break;  //类似于else if
            case 3:  System.out.println();   break;  //类似于else if
            default: System.out.println();   break;      //类似于else
        }
    }
}
